#include "Utils\listKeyClass.h"
#include <string.h>
#include <stdio.h>

CStringKeyCS::CStringKeyCS()
{
}

CStringKeyCS::CStringKeyCS(const CStringKeyCS& copyFrom)
{
	strcpy(keyString ,copyFrom.getString());
}

CStringKeyCS::~CStringKeyCS()
{
}

CStringKeyCS::CStringKeyCS(char* newString)
{
	if (newString == NULL)
	{
		sprintf(keyString,"");
		return;
	}
	memset(keyString, 0, 256);
	strncpy(keyString, newString, 255);
}

void CStringKeyCS::setString(char* newString)
{
	if (newString == NULL)
	{
		sprintf(keyString,"");
		return;
	}
	memset(keyString, 0, 256);
	strncpy(keyString, newString, 255);
}

char* CStringKeyCS::getString() const
{
	return (char*)&keyString[0];
}

bool CStringKeyCS::operator== (CStringKeyCS& compareTo)
{
	return (strcmp(this->keyString,compareTo.getString())==0);
}

bool CStringKeyCS::operator< (CStringKeyCS& compareTo)
{
	return (strcmp(this->keyString,compareTo.getString())<0);
}

bool CStringKeyCS::operator<= (CStringKeyCS& compareTo)
{
	return (strcmp(this->keyString,compareTo.getString())<=0);
}

bool CStringKeyCS::operator> (CStringKeyCS& compareTo)
{
	return (strcmp(this->keyString,compareTo.getString())>0);
}

bool CStringKeyCS::operator>= (CStringKeyCS& compareTo)
{
	return (strcmp(this->keyString,compareTo.getString())>=0);
}

//
CStringKeyCI::CStringKeyCI()
{
}

CStringKeyCI::CStringKeyCI(const CStringKeyCI& copyFrom)
{
	strcpy(this->keyString,copyFrom.getString());
}

CStringKeyCI::~CStringKeyCI()
{
}

CStringKeyCI::CStringKeyCI(char* newString)
{
	if (newString == NULL)
	{
		sprintf(keyString,"");
		return;
	}
	memset(keyString, 0, 256);
	strncpy(keyString, newString, 255);
}

void CStringKeyCI::setString(char* newString) 
{
	if (newString == NULL)
	{
		sprintf(keyString,"");
		return;
	}
	memset(keyString, 0, 256);
	strncpy(keyString, newString, 255);
}

char* CStringKeyCI::getString() const
{
	return (char*)&keyString[0];
}

bool CStringKeyCI::operator== (CStringKeyCI& compareTo)
{
	return (_strcmpi(this->keyString,compareTo.getString())==0);
}

bool CStringKeyCI::operator< (CStringKeyCI& compareTo)
{
	return (_strcmpi(this->keyString,compareTo.getString())<0);
}

bool CStringKeyCI::operator<= (CStringKeyCI& compareTo)
{
	return (_strcmpi(this->keyString,compareTo.getString())<=0);
}

bool CStringKeyCI::operator> (CStringKeyCI& compareTo)
{
	return (_strcmpi(this->keyString,compareTo.getString())>0);
}

bool CStringKeyCI::operator>= (CStringKeyCI& compareTo)
{
	return (_strcmpi(this->keyString,compareTo.getString())>=0);
}